#ifndef __CLogger__
#define __CLogger__

#include <memory>
#include <string>
#include <map>
#include <iostream>
#include "CObject.h"

#define ILOG(x) \
{ \
	thing::CLogger::instance()->Log(thing::INFO,x); \
}

#define DLOG(y) \
{ \
	thing::CLogger::instance()->Log(thing::DEBUG,std::string(__FUNCTION__) + ": " + y); \
}

enum e_LogTypes{INFO,DEBUG,ERROR,FATAL};
class CLogger : public CObject
{
public:
	static CLogger* instance(){
		if(!m_instance.get())
			m_instance = std::auto_ptr<CLogger>(new CLogger());
		return m_instance.get();
	}

	CLogger();
	virtual ~CLogger();
	bool Release();
	void Log(const std::string& LogMsg);
	void Log(e_LogTypes LogType,const std::string& LogMsg);
	const std::string GetString(e_LogTypes LogType);
private:
	std::multimap<e_LogTypes,std::string> m_LogMsg;
	static std::auto_ptr<CLogger> m_instance;
};

#endif
